<?php

abstract class Person
{
    abstract function getJob();
}

class Student extends Person
{
    public function getJob()
    {
        return "学生";
    }
}

class Teacher extends Person
{
    public function getJob()
    {
        return '教师';
    }
}

class BridgeObj
{
    private $person;

    public function setPerson($person)
    {
        $this->person = $person;
    }

    public function getPerson()
    {
        return $this->person;
    }
}

/**
 * 这里很难看出来桥接对象和代理范式的区别，从案例里看似乎二者都是一样的。
 *
 */
$obj = new BridgeObj();
$obj->setPerson(new Teacher());
printf("本次桥接对象：%s", $obj->getPerson());

$obj->setPerson(new Student());
printf("本次桥接对象: %s", $obj->getPerson());

